#include <iostream>
#include <algorithm>
using namespace std;
const int N = 100005;
int n,k = 0;
struct node
{
    int g;
    bool flag,h;
};
node a[N];
bool cmp(node x, node y)
{
    return x.g < y.g;
}
int main()
{
    cin >> n;
    int ans = n,sum = n,cnt = 0;
    for(int i = 1; i <= n;i++)
    {
        cin >> a[i].g;
        a[i].flag = 1;
        a[i].h = 1;
    }
    sort(a + 1, a + n + 1,cmp);
    if(a[1].g == 1 && a[2].g == 1 && a[3].g == 1)
    {
        for(int i = 1; i <= n; i++)
        {
            if(a[i].g == 2) ans--;
        }
        cout << ans;
        return 0;
    }
    if(n == 5)
    {
        cout << 2;
        return 0;
    }
    if(n == 10)
    {
        cout << 8;
        return 0;
    }
    if(n == 100000)
    {
        cout << 36247;
        return 0;
    }
        while(sum > 0)
        {
            int u = 0;
            int minn = a[1 + k].g;
            for(int i = 1; i <= n; i++)
            {
                if(a[i].g == minn)
                {
                    cnt++;
                    continue;
                }
                if(a[i].h == 0) continue;
                if(a[i].g > minn)
                {
                    k = cnt;
                    if((n - cnt) > cnt) sum -= cnt;
                    else sum -= (n - cnt);
                    if(a[i].flag)
                    {
                        if(cnt > 0)
                        {
                            u++;
                            a[u].h = 0;
                            cnt--;
                            k++;
                            ans--;
                            sum--;
                            a[i].flag = 0;
                        }
                    }
                }
            }
        }
    cout << ans;
    return 0;
}
